package com.iwop.moto.service.impl;

import com.iwop.moto.model.SuperRecordModel;
import com.iwop.moto.service.BaseService;
import com.iwop.moto.service.TeamMemberService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @DB_table F_TEAM_MEMBER
 * @author:  liuwb by 2016-09-03 on create
 * @explain: 服务商的维修店团队成员关系表
 */
@Service
public class TeamMemberServiceImpl extends BaseService implements TeamMemberService {

    public static final String insert ="FTeamMemberMapper.insert";
    public static final String findTeamMemberCount ="FTeamMemberMapper.findTeamMemberCount";
    public static final String deleteTeamByFkey ="FTeamMemberMapper.deleteTeamByFkey";
    public static final String findServiceTeamMember ="FTeamMemberMapper.findServiceTeamMember";
    public static final String findServiceTeamMemberCount ="FTeamMemberMapper.findServiceTeamMemberCount";


    /**
     * @功能: 新增 团队成员关系表
     * @日期: liuwb by 2016-09-28 create
     */
    public void insert(SuperRecordModel SRModel){
        getSqlSession().insert(insert,SRModel);
    }

    /**
     * @功能: 查询最少维修店成员的服务商
     * @日期: liuwb by 2016-09-28 create
     */
    public SuperRecordModel findTeamMemberCount (SuperRecordModel SRModel){
        return getSqlSession().selectOne(findTeamMemberCount, SRModel) ;
    }

    /**
     * @功能: 根据fkey(用户子信息)删除
     * @日期: liuwb by 2016-09-29 create
     */
    public void deleteTeamByFkey (String user_fkey){
        getSqlSession().delete(deleteTeamByFkey,user_fkey);
    }

    /**
     * @功能: 镇/乡/街道级>>服务商 所属的团队成员 or 审核成员
     * @日期: liuwb by 2016-09-29 create
     */
    public List<SuperRecordModel> findServiceTeamMember (SuperRecordModel SRModel){
        return getSqlSession().selectList(findServiceTeamMember,SRModel);
    }

    /**
     * @功能: 镇/乡/街道级>>服务商 所属的团队成员 or 审核成员的人数
     * @日期: liuwb by 2016-09-30 create
     */
    public Long findServiceTeamMemberCount(SuperRecordModel SRModel){
        return getSqlSession().selectOne(findServiceTeamMemberCount,SRModel);
    }





}
